//
//  JHFlowLayout.h
//  CustomLayout
//
//  Created by 苗钧豪 on 16/8/3.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class JHFlowLayout;
@protocol JHLayoutDelegate <NSObject>
//关键方法，此方法的作用是返回每一个item的size大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(JHFlowLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(JHFlowLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section;

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(JHFlowLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section;

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(JHFlowLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section;
@end
// 自定义布局，继承于 UICollectionViewLayout
// 切记不要继承于 UICollectionFloewLayout
@interface JHFlowLayout : UICollectionViewLayout
// 列数
@property(nonatomic,assign)NSInteger numberOfColimns;
@property(nonatomic,weak)id<JHLayoutDelegate> delegate;
@property(nonatomic,assign)CGFloat cellMargin; // cell间距
@property(nonatomic,assign) CGFloat itemWidth;
@end
NS_ASSUME_NONNULL_END